<?php
if (! defined ( 'X_APP' )) {
	header ( "HTTP/1.0 404 Not found" );
	exit ();
}
if (function_exists ( '__autoload' )) {
	trigger_error ( "GroupSNS: It looks like your code is using an __autoload() function. GroupSNS uses spl_autoload_register() which will bypass your __autoload() function and may break autoloading.", E_USER_WARNING );
}
$loader = new Apploader ();
spl_autoload_register ( array (
		$loader,
		'autoloader' 
) );
class AppLoader {
	
	/**
	 * Loads a class.
	 *
	 * @param string $className
	 *        	The name of the class to load.
	 */
	public function autoloader($className) {
		if (isset ( $this->_classes [$className] )) {
			include ROOT_PATH . $this->_classes [$className];
			return true;
		} else {
			return false;
		}
	}
	
	/**
	 * <h2>应用动作也业务类路径</h2>
	 * <p>下标是类名，对应项则是相对于网站根的路径</p>
	 *
	 * @var array
	 */
	protected $_classes = array (
			// include
			'GF' => 'include/GF.class.php', // 全局函数
			'Table' => 'include/Table.class.php',
			// controller
			'Action' => '/actions/Action.class.php', // Action基类
			'Index' => 'actions/Index.class.php',
			'User' => 'actions/User.class.php',
			'Activity' => 'actions/Activity.class.php',
			'Qqgroup' => 'actions/Qqgroup.class.php',
			
			// model
			'BaseModel' => 'models/BaseModel.class.php',
			'Auth' => 'models/Auth.class.php',
			'SysInfoModel' => 'models/SysInfoModel.class.php',
			'UserModel' => 'models/UserModel.class.php',
			'GroupModel' => 'models/GroupModel.class.php',
			'ACL' => 'models/ACL.class.php',
			'LevelModel' => 'models/LevelModel.class.php',
			'AttachmentModel' => 'models/AttachmentModel.class.php' 
	);
}